Weather
This page describes weather, conditions that alter the appearance of the game and which can have other effects too. It also describes fogs, which are transparent pictures overlaid on the screen to depict fog, mist, etc. Overworld weather Overworld weather is weather that appears in the game as the player walks around maps, as in the picture above. There are seven kinds of weather, plus the generic "no weather" type. These are defined in the script section PField_Weather as follows: Overworld weather is only referred to by name for the purpose of defining it in the PBS file "metadata.txt". Everywhere else in the script, the weather is a numerical value (the number in the table above) stored in the variable $game_screen.weather_type. Each weather type has its own animation, as described above. These animations are defined in the script section PField_Weather. If the player enters a map with the Rain, HeavyRain or Storm weathers, all berry plants will be automatically watered at that time. Overworld weather has no other effects. Overworld weather influences the weather that occurs in battles. In the script section PField_Field is def pbPrepareBattle, which sets the in-battle weather depending on the overworld weather. The table above shows these relations. The in-battle weather will be permanent, and will not disappear after 5 turns like weather created by various moves does. Setting weather for a map Each map has its own metadata, defined in the PBS file "metadata.txt". There is one metadata property called "Weather", which defines the weather for that map. This metadata has two fields: the weather type, and the probability of it occurring (out of 100). For example: Weather=Snow,50 This means that, when the map is entered, there is a 50% chance that it will start to snow. The weather's probability is checked each time the player enters the map, which means if the probability isn't 100%, the player could simply leave and re-enter the map to change whether the weather exists. This is generally considered undesirable. In-battle weather In-battle weather is a lingering effect, similar to lingering move effects (e.g. Spikes, Stealth Rock). There are three ways to have in-battle weather: * Use a move that induces the weather (lasts for 5 turns). * Have a Pokémon in battle with a weather-inducing ability (lasts for 5 turns, indefinitely or until that Pokémon switches out, depending on the version of the battle mechanics used and the ability that causes it). * Enter a battle on a map where there is overworld weather (lasts indefinitely). The types of in-battle weather are defined in the script section PBWeather. The weather types are as follows: These in-battle weather types are generally named after the moves that induce that weather. They are always referred to in the scripts as "PBWeather::SUNNYDAY" and so on. Note that some moves and abilities are affected by the weather (e.g. the move Moonlight restores 2/3 of the max. HP in SUNNYDAY, not 1/2). These extra effects are not listed in the table above. To find all the things affected by a weather effect, simply search the scripts for the in-battle weather name. Creating new weather Creating a new type of weather is relatively straightforward, although creating an overworld animation can be quite tricky. Firstly, add the new weather's name into module PBFieldWeather and assign it a unique number. Secondly, you should create an animation for your new weather type in the script section PField_Weather. As mentioned, this can be tricky to do. If the weather effect you want is similar to an existing weather type (e.g. micro-meteors are similar to rain), then try to copy that. In any case, you will need to know how to script reasonably well before attempting anything. If your weather exists in battles as well as in the overworld, add the in-battle weather type into the script section PBWeather (you can name it whatever you like, just as long as you consistently call it that elsewhere). Then look in the script section PokeBattle_Battle and, wherever messages show up about the other in-battle weather types, insert something similar for your new one. There should be four places to modify in total. Then, if your new in-battle weather will have any effects (including ones that alter existing moves/abilities), add them in. Finally, consider creating a move and ability that induce your new weather, and perhaps some other new moves/abilities that are affected by it (like how the ability Swift Swim ups the user's Speed only in rain). Fogs Fogs are semi-transparent images that are overlaid on the screen to give the impression of a fog, mist, cloud shadows, beams of sunlight, etc. filling the map. These fog images are stored in the folder "Graphics/Fogs". The image will be tiled, so you don't need an image as big as the map. To display the fog for a map, you will need to use the event command "Change Map Settings" (choosing "Fog Graphic"). The event that contains this command should have a trigger of Parallel Process, which means that the event will run (and the fog appear) as soon as the player enters the map. Only perform this event command if the fog hasn't already been set, though, to avoid lag.